import re


str1 = "What Are The Benefits Of Paying More Taxes?"
# 找到前6个字符
first_six_chars = str1[:6]
print(first_six_chars)
# 使用推导式获取所有大写字母
# for char in str1:
#     if char.isupper():
#         print(char)

# for 左边是输出  右是处理
uppercase_letters = [char for char in str1 if char.isupper()]
print(uppercase_letters)
# 输出所有文字里面的单词
words = re.findall(r'\b\w+\b', str1)
print(words)